import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

import Index from "../pages/index";
import Order from "../pages/bis/order";
import Setting from "../pages/bis/setting";


const routes = [
  {
    path: "/",
    component: Index,
    meta: {
      title: "Control App"
    }
  },
  {
    path: "/order",
    component: Order,
    meta: {
      title: "指令列表"
    }
  },
  {
    path: "/setting",
    component: Setting,
    meta: {
      title: "设置"
    }
  },
];

const router = new VueRouter({
  mode: "history",
  base: "/",
  routes
});

router.beforeEach((to, from, next) => {
  document.title = to.meta.title || 'Document';
  next();
});

export default router;
